package com.prp.service;

import java.util.List;
import java.util.Set;

import com.prp.dao.Userinfo;
import com.prp.dao.UserinfoDAO;
import com.prp.interfaces.IUserAuthoritySys;

public class UserAuthoritySys implements IUserAuthoritySys{

	public Set getUserAuthority(String username) {
		
		if(username == null){
			return null;
		}
		
		UserinfoDAO userinfoDAO = new UserinfoDAO();
		List tempList = userinfoDAO.findByUsername(username); 
		
		if( tempList.size() == 0){
			return null;
		}
		
		Set authSet = ((Userinfo) tempList.get(0)).getAdminroles();
		
		if(authSet.size() > 0)	
			return authSet;
		else
			return null;
	}
}
